#include <iostream>
using namespace std;
class Solution {
public:
    int mySqrt(int x) {
        if (x == 0) return 0;
        int left = 1;
        int right = x;
        int mid = left + (right - left + 1) / 2;
        while (left < right)
        {
            if ((long long)mid * mid > x)
            {
                right = mid - 1;
                mid = left + (right - left + 1) / 2;
            }
            else
            {
                left = mid;
                mid = left + (right - left + 1) / 2;
            }
        }
        return mid;
    }
};
int main()
{
	return 0;
}